<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang='en'>
<head>
	<meta charset='utf-8' />
	<title>广溢信息技术有限公司</title>
	<meta content='' name='description' />
	<meta content='' name='author' />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<!-- Bootstrap -->
	<link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet" >
    <link href="__PUBLIC__/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
	<link href="__PUBLIC__/css/font-awesome.min.css" rel="stylesheet" >

	<!--[if IE 7]>
		<link  href="__PUBLIC__/css/font-awesome-ie7.min.css" rel="stylesheet">
	<![endif]-->

	<!--[if lt IE 9]>
		<link type="text/css" href="__PUBLIC__/css/custom-theme/jquery.ui.1.9.2.ie.css"  rel="stylesheet" />
	<![endif]-->

	<link href="__PUBLIC__/css/bootstrap-responsive.css" rel="stylesheet">
	<link href="__PUBLIC__/css/test.css" rel="stylesheet">
	<script src="__PUBLIC__/js/jquery.js"></script>

	<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	<script src="__PUBLIC__/js/html5shiv.js"></script>
	<script src="__PUBLIC__/js/respond.min.js"></script>
	<![endif]-->
	<script type="text/javascript">
	var upload_url="<?php echo U('file/upload?module='.MODULE_NAME);?>";
	var del_url="<?php echo U('File/del');?>";
	var session_id="<?php echo session_id();?>";	
	var _hmt = _hmt || [];
	(function() {
	  var hm = document.createElement("script");
	  hm.src = "//hm.baidu.com/hm.js?2a935166b0c9b73fef3c8bae58b95fe4";
	  var s = document.getElementsByTagName("script")[0]; 
	  s.parentNode.insertBefore(hm, s);
	})();
</script>
</head>
<body>
	<div class="shade"></div>
	<div class="row-fluid navbar visible-phone">
	<div class="row-fluid">
		<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
		<a data-toggle="collapse" data-target="#top_menu" class="right">
		<i class="brand icon-th-list"></i>
		</a>
	</div>
	<div class="col-lapse" id="top_menu">
		<ul class="nav nav-pills">
			<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
					<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
				</li><?php endforeach; endif; else: echo "" ;endif; ?>
		</ul>
	</div>
</div>
<div class="row-fluid navbar hidden-phone">
	<a class="brand" href="<?php echo U('home/index');?>">广溢网络</a>
	<ul class="nav nav-pills">
		<?php if(is_array($list_top_menu)): $i = 0; $__LIST__ = $list_top_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tag): $mod = ($i % 6 );++$i;?><li>
				<a  href="#" url="<?php echo U($tag['url']);?>" node="<?php echo ($tag["id"]); ?>" onclick="click_top_menu(this)"><?php echo ($tag["name"]); ?></a>
			</li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>
	<aside>
		<span>
			<a href="<?php echo U('UserConfig/index');?>">设置</a>
		</span>
		<span>
			<a href="<?php echo U('profile/index');?>"><?php echo (session('user_name')); ?></a>
		</span>
		<span>
			<a href="<?php echo U('login/logout');?>">退出</a>
		</span>
		&nbsp;&nbsp;
	</aside>
</div>

	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span3 left_menu">
				<div class="visible-phone">
	<h4 class="btn no-border" data-toggle="collapse" data-target="#left_menu">		
			<?php echo ($top_menu_name); ?><i class="icon-angle-down"></i>
		</h4>
	<div class="col-lapse" id="left_menu"><?php echo ($html_left_menu); ?></div>
</div>
<div class="hidden-phone">
	<h4><?php echo ($top_menu_name); ?></h4>
	<div><?php echo ($html_left_menu); ?></div>
</div>
			</div>
			<div class="span9 content">
<script type="text/javascript">
	function mark(action) {
		var vars = $("#form_data").serialize();
		switch (action) {
			case "readed":
				sendAjax("<?php echo U('mark?action=readed');?>", vars, function(data) {
					if (data.status) {
						$("input[name='mail_id[]']:checked").each(function() {
							$(this).parents("li").removeClass("bold");
							$(this).parents("li").addClass("normal");
							$(this).attr("checked", false);
						})
					}
				});
				break;
			case "unread":
				sendAjax("<?php echo U('mark?action=unread');?>", vars, function(data) {
					if (data.status) {
						$("input[name='mail_id[]']:checked").each(function() {
							$(this).parents("li").removeClass("normal");
							$(this).parents("li").addClass("bold");
							$(this).attr("checked", false);
						})						
					}
				});

				break;
			case "del":
				sendAjax("<?php echo U('mark?action=del');?>", vars, function(data) {
					if (data.status) {
						alert(data.info);
						$("input[name='mail_id[]']:checkbox:checked").each(function() {
							$(this).parents("li").remove();
						})
					}
				});
				break;
			case "del_forever":
				if (confirm('确定要删除吗?')) {
					sendAjax("<?php echo U('mark?action=del_forever');?>", vars, function(data) {
						if (data.status) {
							alert(data.info);
							$("input[name='mail_id[]']:checkbox:checked").each(function() {
								$(this).parents("li").remove();
							})
						}
					});
				}
				break;
			case "spam":
				sendAjax("<?php echo U('mark?action=spam');?>", vars, function(data) {
					if (data.status) {
						alert(data.info);
						$("input[name='mail_id[]']:checkbox:checked").each(function() {
							$(this).parents("li").remove();
						})
					}
				});
				break;
			default:
		}
		$("#chk_select_all").attr("checked", false);
	}

	function forword() {
		if ($("input[name='mail_id[]']:checkbox:checked").length == 1) {
			window.open("http://localhost/mail/reply/id/" + $("input[name='mail_id[]']:checkbox:checked:first").val() + "/type/forward", "main");
		} else {
			alert("请选择一封要转发的邮件");
		};
	}

	function move_to(val) {
		var vars = $("#form_data").serialize();
		sendAjax("<?php echo U('mark?action=move_folder');?>", 'val=' + val + '&' + vars);
		$("input[name='mail_id[]']:checkbox:checked").each(function() {
			$(this).parents("li").hide();
		})
	}

	$(document).ready(function() {
		$("#move_to li").click(function() {
			move_to($(this).attr("id"));
		})
		set_return_url();
		$(".input-date").datepicker();
	<?php if(!empty($receve)): ?>sendAjax("<?php echo U('receve');?>");<?php endif; ?>
	});
</script>
<div class="mail">
	<form id="form_search" method='post' >
		<div class="row-fluid title">
			<span><?php echo ($folder_name); ?></span>
			<div class="input-append right">
				<input type="text"  onkeydown="key_search();" name="keyword" id="keyword">
				<a class="btn" type="button" onclick="btn_search();"> <i class="icon-search"></i>
				</a>
				<a class="btn" onclick="open_search();"> <i class="icon-angle-down"></i>
				</a>
			</div>
		</div>
		<div class="row-fluid adv_search">
			<div class="row-fluid adv_search_head">
				<h4 class="left">高级搜索</h4>
				<div class="right text-right">
					<a  class="btn" onclick="adv_search();">搜索</a>
					<a  class="btn" onclick="close_search();">关闭</a>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="li_title">标题：</label>
					<div class="controls">
						<input type="text" id="li_title" name="li_title"></div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="li_content">内容：</label>
					<div class="controls">
						<input type="text" id="li_content" name="li_content" ></div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group span6">
					<label class="control-label" for="li_from">发件人：</label>
					<div class="controls">
						<input type="text" id="li_from" name="li_from"></div>
				</div>
				<div class="control-group span6">
					<label class="control-label" for="be_create_time">登录时间：</label>
					<div class="controls">
						<input  type="text" name="be_create_time" id="be_create_time" class="input-date" readonly="readonly">
						&nbsp;~&nbsp;
						<input type="text" name="en_create_time" id="en_create_time" readonly="readonly" class="input-date" ></div>
				</div>
			</div>
		</div>
	</form>
	<div class="row-fluid operate">
		<div class="left">
			<a onclick="mark('del');" class="btn">删除</a>
			<a onclick="mark('del_forever');" class="btn">彻底删除</a>
			<a onclick="forword();" class="btn">转发</a>
			<a onclick="mark('spam');" class="btn">举报</a>
			<div class="btn-group">
				<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
					标记为
					<span class="caret"></span>
				</a>
				<ul class="dropdown-menu">
					<li onclick="mark('readed');">
						<a>已读</a>
					</li>
					<li onclick="mark('unread');">
						<a>未读</a>
					</li>
				</ul>
			</div> 
			<div class="btn-group" id="move_to">
				<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
					转移到
					<span class="caret"></span>
				</a>
				<ul class="dropdown-menu"><?php echo ($folder_list); ?></ul>
			</div>
		</div>
	</div>
	<form method="post" action="" name="form_data" id="form_data">
		<div class="table">
			<ul>
				<li class="thead" style="padding-left:30px">
					<span class="checkbox">
						<input type="checkbox" id="chk_select_all" value="all" onclick="select_all('mail_id[]')"/>
					</span>
					<span class="col-20">
						<?php if(in_array(($folder), explode(',',"darftbox,outbox"))): ?>收件人
							<?php else: ?>
							发件人<?php endif; ?>
					</span>
					<span class="col-9 right text-center" >时间</span>
					<span class="autocut auto">主题</span>
				</li>
				<?php if(count($list) == 0 ): ?><li class="tbody text-center">
						<h3>没找到相应的数据</h3>
					</li>
				</ul>
			</div>
			<?php else: ?>
			<?php if(is_array($list)): foreach($list as $key=>$vo): ?><li class="tbody <?php if(($vo["read"]) == "1"): ?>normal<?php endif; if(($vo["read"]) == "0"): ?>bold<?php endif; ?>" style="padding-left:30px">
				<span  class="checkbox col-20" >
					<input name="mail_id[]" type="checkbox" value="<?php echo ($vo["id"]); ?>"/>
					<div class="wrap">
						<?php if(in_array(($folder), explode(',',"darftbox,outbox"))): echo (show_contact($vo["to"])); ?>
							<?php else: ?>
							<?php echo (show_contact($vo["from"])); endif; ?>
					</div>
				</span>
				<span  class="col-9 right text-center" ><?php echo (todate($vo["create_time"],'Y-m-d')); ?></span>
		<span class="autocut auto">
			<?php if(!empty($vo['add_file'])): ?><i class="icon-paper-clip"></i>
				<?php else: ?>
				<i class="icon-paper-clip" style="text-indent:-9999px;"></i><?php endif; ?>
			<?php if(in_array(($folder), explode(',',"darftbox"))): ?><a  title="<?php echo (htmlspecialchars($vo["title"])); ?>" href="<?php echo U('edit?id='.$vo['id']);?>">
					<?php echo ($vo["title"]); ?>&nbsp;&nbsp;&nbsp;
					<?php if((strlen($vo["title"])) == "0"): ?>无标题<?php endif; ?>
				</a>
				<?php else: ?>
				<a title="<?php echo (htmlspecialchars($vo["title"])); ?>" href="<?php echo U('read?id='.$vo['id']);?>">
					<?php echo ($vo["title"]); ?>&nbsp;&nbsp;&nbsp;
					<?php if((strlen($vo["title"])) == "0"): ?>无标题<?php endif; ?>
				</a><?php endif; ?>
		</span>
	</li><?php endforeach; endif; ?>
</ul>
</div>
</form>
<div class="page"><?php echo ($page); ?></div><?php endif; ?>
</div></div>
		</div>
	</div>
	<div class="msg popout"></div>
	<iframe src="<?php echo U('push/client');?>" class="push" id="push"></iframe>
	<script src="__PUBLIC__/js/bootstrap.min.js"></script>
	<script src="__PUBLIC__/js/jquery-ui-1.9.2.custom.min.js"></script>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
</html>